package org.andy.shop.service;


import java.util.List;

import org.andy.shop.model.UserInfo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.alibaba.fastjson.JSON;
import com.qunar.paydata.platform.common.util.EmailUtil;

/**
 * 
 * @author leonyang.liu
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:spring.xml",
		"classpath:spring-mybatis.xml" })
public class TestUserService {

	@Autowired
	private UserService userService;

	
	@Test
	public void testQueryById1() {
		UserInfo userInfo = userService.getUserById(1);
//		LOGGER.info(JSON.toJSON(userInfo));
		System.out.println(JSON.toJSON(userInfo));
	}

	@Test
	public void testQueryAll() {
		List<UserInfo> userInfos = userService.getUsers();
//		LOGGER.info(JSON.toJSON(userInfos));
		System.out.println(JSON.toJSON(userInfos));
	}

	@Test
	public void testInsert() {
		UserInfo userInfo = new UserInfo();
		userInfo.setUname("xiaoming");
		userInfo.setUnumber(4);
		System.out.println(userInfo);
		int result = userService.insert(userInfo);
		System.out.println(result);
	}
	
	@Test
	public void jfreechat(){
//		ChartUtil.genPayCentreReport();
//		System.out.println("生成柱状图完毕！");
	}
	
	@Test
	public void wsSheetChart(){
//		ChartUtil.genWorksheetNum();
//		System.out.println("生成柱状图完毕！");
	}
	@Test
	public void testEmail() throws Exception{
//		EmailUtil.createEmail();
//		System.out.println("成功创建邮件！");
	}
}
